import type { RouteRecordRaw } from 'vue-router';
import { $t } from '#/locales';

const routes: RouteRecordRaw[] = [
  {
    meta: {
      icon: 'mdi:monitor-dashboard',
      keepAlive: true,
      order: 800,
      title: $t('daprplus.title'),
      authority: ['identity-api'],
    },
    name: 'DaprPlus',
    path: '/',
    children: [
      {
        meta: {
          icon: 'mdi:shield-account',
          title: $t('daprplus.auth.title'),
          keepAlive: true,
          authority: ['identity-api'],
        },
        name: 'Auth',
        path: '/auth',
        children: [
          {
            meta: {
              icon: 'mdi:account',
              title: $t('daprplus.auth.user.title'),
              keepAlive: true,
              authority: ['User:GetPage'],
            },
            name: 'User',
            path: 'user',
            component: () => import('#/views/daprplus/auth/user/user.vue'),
          },
          {
            meta: {
              icon: 'mdi:account-group',
              title: $t('daprplus.auth.role.title'),
              keepAlive: true,
              authority: ['Role:GetPage'],
            },
            name: 'Role',
            path: 'role',
            component: () => import('#/views/daprplus/auth/role.vue'),
          },
          {
            meta: {
              icon: 'mdi:database',
              title: $t('daprplus.auth.resource.title'),
              keepAlive: true,
              authority: ['Resource:GetPage'],
            },
            name: 'Resource',
            path: 'resource',
            component: () =>
              import('#/views/daprplus/auth/resource/resource.vue'),
          },
          {
            meta: {
              icon: 'mdi:shield-key',
              title: $t('daprplus.auth.role.authorize'),
              keepAlive: true,
              authority: ['RoleResource:GetPage'],
            },
            name: 'RoleAuthorize',
            path: 'role-authorize',
            component: () =>
              import('#/views/daprplus/auth/role-authorize/role-authorize.vue'),
          },
          {
            meta: {
              icon: 'mdi:office-building',
              title: $t('daprplus.auth.organization.title'),
              keepAlive: true,
              authority: ['Organization:GetPage'],
            },
            name: 'Organization',
            path: 'organization',
            component: () => import('#/views/daprplus/auth/organization.vue'),
          },
          {
            meta: {
              icon: 'mdi:history',
              title: $t('daprplus.auth.loginLog.title'),
              keepAlive: true,
              authority: ['LoginLog:GetPage'],
            },
            name: 'LoginLog',
            path: 'login-log',
            component: () => import('#/views/daprplus/auth/login-log.vue'),
          },
        ],
      },
    ],
  },
];

export default routes;
